package com.pentajock.docdb.types;

public class User implements Comparable<User> {
	private String userName;
	private String oldUserName;
	private String firstName;
	private String lastName;
	private String departmentName;
	private boolean isAdmin;
	private boolean isSupervisor;

	public User() {
		this.userName = "";
		this.oldUserName = "";
		this.firstName = "";
		this.lastName = "";
		this.departmentName = "";
		this.isAdmin = false;
		this.isSupervisor = false;
	}
	
	public User(String userName,
				 String firstName,
				 String lastName,
				 String departmentName,
				 boolean isAdmin,
				 boolean isSupervisor) {
		this.userName = userName;
		this.oldUserName = userName;
		this.firstName = firstName;
		this.lastName = lastName;
		this.departmentName = departmentName;
		this.isAdmin = isAdmin;
		this.isSupervisor = isSupervisor;
	}
	
	public String getUserName() {
		return userName;
	}
	
	public String getOldUserName() {
		return oldUserName;
	}
	
	public void setUserName(String userName) {
		this.oldUserName = this.userName;
		this.userName = userName;
	}
	
	public String getFirstName() {
		return firstName;
	}
	
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	
	public String getLastName() {
		return lastName;
	}
	
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	public String getDepartmentName() {
		return departmentName;
	}
	
	public void setDepartmentName(String departmentName) {
		this.departmentName = departmentName;
	}
	
	public boolean isAdmin() {
		return isAdmin;
	}
	
	public void setIsAdmin(boolean isAdmin) {
		this.isAdmin = isAdmin;
	}
	
	public boolean isSupervisor() {
		return isSupervisor;
	}
	
	public void setIsSupervisor(boolean isSupervisor) {
		this.isSupervisor = isSupervisor;
	}
	
	public String getFullName() {
		return toString();
	}
	
	public boolean equals(Object o) {
		if(o != null && o instanceof User) {
			boolean a = (getUserName() == ((User)o).getUserName());
			boolean b = (getDepartmentName() == ((User)o).getDepartmentName());
			return a && b;
		}
		return false;
	}
	
	public int compareTo(User u) {
		return getUserName().compareTo(u.getUserName());
	}
	
	public String toString() {
		return getFirstName() + " " + getLastName();
	}
}
